

import swarm.Selector;

public abstract class SwarmUtils {
	static Selector sel;
	
	static Selector getSelector(Object classId, String method)
	{
		try
		{
		    sel = new Selector(classId.getClass(), method, false);
		} 
		catch (Exception e)
		{
			System.err.println("Exception " + method + ": " + 
					   e.getMessage ());
			System.exit(1);
		}
		return sel;
	}
	
	static Selector getSelector(Object classId, String method, boolean b)
	{
		try
		{
		    sel = new Selector(classId.getClass(), method, b);
		} 
		catch (Exception e)
		{
			System.err.println("Exception " + method + ": " + 
					   e.getMessage ());
			System.exit(1);
		}
		return sel;
	}
	
	static Selector getSelector(String className, String method)
	{
		try
		{
		    sel = new Selector(Class.forName(className), method, false);
		}
		catch (Exception e)
		{
			System.err.println("Exception " + method + ": " + 
					   e.getMessage ());
			System.exit(1);
		}
		return sel;
	}
}
